package jianzhiOffer;
//剑指 Offer 63. 股票的最大利润
public class Num63_maxProfit {
    public int maxProfit(int[] prices) {
        int min = Integer.MIN_VALUE;
        int max = 0;
        for (int i = 0; i < prices.length; i++) {
            min = Math.min(min , prices[i]);
            max = Math.max(max , prices[i] - min);
        }
        return max;
    }
}

/**
 * 动态规划
 */

